'''
Calendar Use Case Tests

1)Confirm same amount of evnt show up on the calendar eac time you enter it.
2)Make sure 3 events show up on on today
3)Confirm events do not change in week mode
'''

from interactive import *

#1)
css("#ColonyView")
linkpart("EPO").click()
twait()

css("#ColonyMenu")
linkpart("Reschedule").click()
twait()
alert = driver.switch_to_alert()
assert(alert.text == "Successfully rescheduled.")
alert.accept()

css("#ColonyMenu")
linkpart("Calendar").click()
twait()

i=0

for event in driver.find_elements_by_class_name("fc-event"):
	i = i+1
	
Back()
twait()

css("#ColonyMenu")
linkpart("Calendar").click()
twait()

j=0

for event in driver.find_elements_by_class_name("fc-event"):
	j = j+1
	
assert(i==j)

#2)
assert(driver.execute_script("return $('#Calendar div.fc-view-month tr:has(.fc-today) .fc-first .fc-day-content div').get(0)")
        .value_of_css_property("height") == "57px")

#3)

css("a[title='Month']").click()
twait()

assert(css("#Calendar div.fc-view-basicWeek tr.fc-week0 td.fc-first .fc-day-content div")
        .value_of_css_property("height") == "57px")

driver.quit()
